<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_newscomment.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%@ page import="com.lmpop.trade.ti_news.*"%> 
<%@page import="com.lmpop.trade.ti_channel.*" %>	
<%
	request.setCharacterEncoding("UTF-8");
	Map ti_newscomment = new Hashtable();
	String g_title = "";
	if(request.getParameter("title")!=null && !request.getParameter("title").equals("")){
		g_title = request.getParameter("title");
		ti_newscomment.put("title",g_title);
	}
   String g_ch_id = "";
	if(request.getParameter("class_attr")!=null && !request.getParameter("class_attr").equals("")){
		g_ch_id = request.getParameter("class_attr");
		ti_newscomment.put("class_attr",g_ch_id);
	}
	String g_news_id = "";
	if(request.getParameter("news_idx")!=null && !request.getParameter("news_idx").equals("")){
		g_news_id = request.getParameter("news_idx");
		ti_newscomment.put("news_idx",g_news_id);
	}
 String start_date = "";
  if(request.getParameter("start_date")!=null && !request.getParameter("start_date").equals("")){
	start_date = request.getParameter("start_date");
	ti_newscomment.put("start_date",start_date);
	}
	String end_date = "";
	if(request.getParameter("end_date")!=null && !request.getParameter("end_date").equals("")){
	end_date = request.getParameter("end_date");
	ti_newscomment.put("end_date",end_date);
	}
	Ti_newscommentInfo ti_newscommentInfo = new Ti_newscommentInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_newscommentInfo.getListByPageAdmin(ti_newscomment,Integer.parseInt(iStart),limit);
	int counter = ti_newscommentInfo.getCountByObjAdmin(ti_newscomment);																												//	fixed by Zhouxq
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?class_attr="+g_ch_id+"&title="+g_title+"&news_idx="+g_news_id+"&iStart=",Integer.parseInt(iStart),limit);
     Ti_newsInfo newsinfo = new Ti_newsInfo();
	 Ti_channelInfo channelinfo = new Ti_channelInfo();	   					   
	String select = channelinfo.getChannelTreeByTLevel("000000000000000");
	
	
	String para ="class_attr="+g_ch_id+"&title="+g_title+"&news_idx="+g_news_id+"&iStart="+Integer.parseInt(iStart);
	%>
<html>
  <head>
    
    <title>资讯评论</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ti_channelInfo.js'></script>
    <script type="text/javascript" src="news.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>资讯评论</h1>
			</td>			
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post" id="indexForm" target="_self"> 
    <input type="hidden" value="" name="news_idx" id="news_idx"/>	
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
				按资讯标题: 
				<input type="text" value="" name="title" id="title" size="20" class="input" />
				按发布时间段:
				<input name="start_date" id="txtStartDate" type="text" class="Wdate" value="" 
				
				onclick="WdatePicker({maxDate:'#F{$dp.$D(\'txtEndDate\',{d:-1})}',readOnly:true})" size="15" />
				 - 
				<input name="end_date" id="txtEndDate" type="text" class="Wdate" value="" onclick="WdatePicker({minDate:'#F{$dp.$D(\'txtStartDate\',{d:1})}',readOnly:true})" size="15"/>
				<input name="searchInfo" type="button" value="搜索" onclick="return seacher()"/>
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			
			<th width="30%">评论内容</th>
			
		  	<th>资讯标题</th>
		  	
		  	<th>评论人</th>
		  	
		  	<th>评论时间</th>
		  			  	
		  	
		  	
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String info_id="",news_id="",ch_id="",in_date="",content="",title="",ch_name="",user_id="",user_name="",up_num="",down_num="";
		  			if(map.get("info_id")!=null) info_id = map.get("info_id").toString();
					if(map.get("news_id")!=null) {
					news_id = map.get("news_id").toString();					
					title=newsinfo.gettitle(news_id);
					if(title.length()>26)title=title.substring(0,26);
					}
					if(map.get("ch_id")!=null) {
					ch_id = map.get("ch_id").toString();					
					ch_name="<a href=index.jsp?class_attr="+ch_id+">"+newsinfo.getch_name(ch_id)+"</a>&nbsp;";
					}
					if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
					if(in_date.length()>10)in_date=in_date.substring(0,10);
					if(map.get("content")!=null) content = map.get("content").toString();
					content=content.replaceAll("<[^>]*>","");
					//if(content.length() > 20){content = content.substring(0,20);}
					
					if(map.get("user_name")!=null) {
					user_name = map.get("user_name").toString();					
					}
					if(map.get("up_num")!=null) up_num = map.get("up_num").toString();
					if(map.get("down_num")!=null) down_num = map.get("down_num").toString();

		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=info_id %>" /></td>
			
			<td width="30%"><%=content%></td>	
			
		  	<td><a href="updateInfo.jsp?info_id=<%=info_id%>&<%=para%>"><%=title%></a></td>

		  	<td><%=user_name%></td>		 
		  	
		  	<td><%=in_date%></td> 
		  	
		  
		  	
			<td width="10%"><a href="updateInfo.jsp?info_id=<%=info_id %>&<%=para%>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:delOneNews('<%=info_id%>');"><img src="/program/admin/images/delete.gif" title="删除" /></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="9243" />
	  </form>
</body>

</html>
